<template>
  <!--收款确认记录页面-->
  <div class="jilu">
    <div class="search">
      <input type="text" placeholder="搜索会员登录账号" v-model="accountName">
      <img src="../../../assets/search.png" alt="" width="16" @click="mySeach(accountName)">
    </div>
    <div class="page-infinite-wrapper" ref="wrapper" :style="{ height: wrapperHeight + 'px' }">
      <wv-group
        v-infinite-scroll="getList"
        infinite-scroll-disabled="loading"
        infinite-scroll-distance="10"
      >
        <wv-panel class="lists">
          <wv-media-box thumb="thumb" v-for="(item,index) in gatheringRecordList" :key="item.index"
                        :title="item.goodsName" :description="'登录账号：'+item.accountName"
                        @click="goDetail(item.gatheringRecordId)" type="text">
            <p class="weui-media-box__info" slot="box_ft">
              支付时间：{{item.payDate}} <img src="../../../assets/right.png" alt="" width="10">
            </p>
          </wv-media-box>
        </wv-panel>
      </wv-group>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  import {shoukuanjilu} from '../../../../test/unit/http'
  import {Toast} from 'we-vue'

  export default {
    name: '',
    props: {},
    data() {
      return {
        accountName: '',
        gatheringRecordList: [],
        page: 1,
        rows: 10,
        pages: 0,
        list: [],
        totalNum: 0,
        wrapperHeight: 0,
        loading: false,
      };
    },
    methods: {
      goDetail(gatheringRecordId) {
        this.$router.push({name: 'confirmend', query: {'gatheringRecordId': gatheringRecordId}})
      },
      getList() {
        this.loading = true;
        let params = {
          accountName: this.accountName,
          page: this.page,
          rows: this.rows
        };
        shoukuanjilu(params).then(res => {
          console.log(res);
          if (res.code == 100) {
            let data = res.object;
            let list = data.rows;
            let pages = data.pages;
            this.pages = pages;
            let page = data.page;
            this.page = page;
            let totalNum = data.totalNum;
            this.totalNum = totalNum;
            if (list.length > 0) {
              this.gatheringRecordList = this.gatheringRecordList.concat(list);
            }
          }
          if (this.page < this.pages) {
            this.page++;
            this.loading = false
          } else {
            this.loading = true
          }
        }).catch(err => {
          console.log(err);
        });
      },
      goSearch() {
        this.page = 1;
        this.gatheringRecordList = [];
        this.getList();
      }
    },
    created() {
    },
    components: {}
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less" rel="stylesheet/less">
  .weui-panel:before {
    border-top: none;
  }

  .lists {
    text-align: left;

    .weui-media-box__info img {
      position: absolute;
      right: 25px;
      top: 37%
    }
  }

  .search {
    position: relative;
    width: 95%;
    margin: 10px auto;

    input {
      width: 90%;
      border: 1px solid #eee;
      box-shadow: 0 3px 4px rgba(17, 17, 17, 0.05);
      border-radius: 7px;
      height: 25px;
      line-height: 25px;
      padding: 10px;
      color: #111;
    }

    img {
      position: absolute;
      right: 20px;
      top: 16px;
    }
  }
</style>

